package com.huaxia.day14;

import java.util.Timer;

/**
 * 定时任务
 */

public class TimerTest {
    public static void main(String[] args) {
        MyTimeTask printThread = new MyTimeTask();
        Timer timer = new Timer();
         System.out.println("主线程");
         System.out.println(System.currentTimeMillis());
//        timer.schedule(printThread,500);//延迟500毫秒执行
        timer.schedule(printThread,100,5000);// 延迟100毫秒后每500毫秒周期执行
    }
}
